﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style type="text/css">
    .form .formValue input.form-control {
        height: 32px;
        line-height: 32px;
        padding: 0px;
        resize: none;
        border-radius: 0px;
        box-shadow: none;
        text-indent: 5px
    }

    .textValue {
        width: 100%;
    }

    .selectbox {
        color: #444;
        line-height: 34px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        height: 34px;
        width: 100%;
    }

    .search {
        margin-left: 10px;
        padding: 0px;
    }

    table td {
        height: 40px;
        line-height: 40px;
    }

    .zdyPanel {
        background-color: #fff;
        border-top: 1px solid #ddd;
        border-left: 1px solid #ddd;
        border-right: 1px solid #ddd;
        margin: 0px;
        float: left;
        width: 100%;
    }

    .zdyTool {
        float: left;
        padding-left: 10px;
        width: 100%;
    }

    .zdyBar {
        padding: 0px;
        margin: 0px;
        margin-top: 3px;
    }

    .zdyUL {
        list-style-type: none;
        margin: 5px 0px 0px -3px;
        padding: 0px;
    }

        .zdyUL li {
            float: left;
            list-style: none;
            height: 24px;
            line-height: 22px;
        }

            .zdyUL li a {
                cursor: pointer;
                padding: 5px 10px;
                border-radius: 4px;
            }

            .zdyUL li i {
                margin-right: 4px;
                font-size: 13px;
                color: #666;
                vertical-align: middle;
                margin-top: -1px;
            }

            .zdyUL li a:hover {
                text-decoration: none;
                background-color: #1ABC9C;
                color: #fff;
            }

    .zdyGirdPanel {
        width: 100%;
        margin: 0px;
        padding: 0px;
        float: left;
    }

    .zdyContentPanel {
        width: 100%;
        margin: 5px 0px 0px 0px;
        padding: 0px;
        float: left;
    }

    .zdyFont {
        padding-left: 5px;
        color: #ff6a00;
    }

    .autocomplete-suggestions {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        border: 1px solid #999;
        background: #FFF;
        cursor: default;
        overflow: auto;
        -webkit-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
        -moz-box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
        box-shadow: 1px 4px 3px rgba(50, 50, 50, 0.64);
    }

    .autocomplete-selected {
        background: #F0F0F0;
    }

    .autocomplete-suggestion {
        padding: 2px 5px;
        white-space: nowrap;
        overflow: hidden;
    }

    .autocomplete-no-suggestion {
        padding: 2px 5px;
    }

    .zdyUL {
        list-style-type: none;
        margin: 5px 0px 0px -3px;
        padding: 0px;
    }

        .zdyUL li {
            float: left;
            list-style: none;
            height: 24px;
            line-height: 22px;
        }

            .zdyUL li a {
                cursor: pointer;
                padding: 5px 10px;
                border-radius: 4px;
            }

            .zdyUL li i {
                margin-right: 4px;
                font-size: 13px;
                color: #666;
                vertical-align: middle;
                margin-top: -1px;
            }

            .zdyUL li a:hover {
                text-decoration: none;
                background-color: #1ABC9C;
                color: #fff;
            }

    .zdyGirdPanel {
        padding-top: 3px;
    }
    .form .formValue {
        padding: 1px 3px;
    }
</style>
<script type="text/javascript">
    var resultData = {};
    var selectPage = -1;
    $(function () {
        GetItems();
        gridList();
    });

    function GetItems() {
        resultData = getCache("CLIENT_MYCLIENT");
        if (!resultData || resultData.length <= 0) {
            $.ajax({
                url: "/ClientManager/ClientInfos/GetItems",
                dataType: "json",
                async: false,
                success: function (data) {
                    resultData = data;
                    InitControl();
                    setCache("CLIENT_MYCLIENT", data);
                }, error: function (XMLHttpRequest, textStatus, errorThrown) {
                }
            });
        } else {
            InitControl();
        }
    }

    function InitControl() {
        var F_ClientType = resultData.F_ClientType;
        for (var i = 0; i < F_ClientType.length; i++) {
            $("#F_ClientType").append("<option value='" + F_ClientType[i].F_ItemCode + "'>" + F_ClientType[i].F_ItemName + "</option>");
        }

        var F_IndustryId = resultData.F_IndustryId;
        for (var i = 0; i < F_IndustryId.length; i++) {
            $("#F_IndustryId").append("<option value='" + F_IndustryId[i].F_ItemCode + "'>" + F_IndustryId[i].F_ItemName + "</option>");
        }

        //var F_CityId = resultData.F_CityId;
        //for (var i = 0; i < F_CityId.length; i++) {
        //    $("#F_CityId").append("<option value='" + F_CityId[i].F_Id + "'>" + F_CityId[i].F_ItemName + "</option>");
        //}
        $("#F_CityId").bindSelect({
            url: "/ClientManager/ClientInfos/GetAllCitys",
            search: true,
            id: "F_EnCode",
            text: "F_FullName"
        });

        var Clients = [];
        var SiteClients = resultData.SiteClients;
        for (var i = 0; i < SiteClients.length; i++) {
            Clients.push({ value: SiteClients[i].F_ClientName, data: SiteClients[i].F_Id });
        }

        $("#F_ClientName").autocomplete({
            lookup: Clients,
            onSelect: function (suggestion) {
                $("#hd_ClientName").val(suggestion.data);
            }
        });
    }

    function GetDictionaries(value,type) {
        if (type == "F_ClientType") {
            for (var i = 0; i < resultData.F_ClientType.length; i++) {
                if (value == resultData.F_ClientType[i].F_ItemCode)
                {
                    return resultData.F_ClientType[i].F_ItemName;
                }
            }
            return '';

        } else if (type == "F_CompanyType") {
            for (var i = 0; i < resultData.F_CompanyType.length; i++) {
                if (value == resultData.F_CompanyType[i].F_ItemCode) {
                    return resultData.F_CompanyType[i].F_ItemName;
                }
            }
            return '';
        } else if (type == "F_IndustryId") {
            for (var i = 0; i < resultData.F_IndustryId.length; i++) {
                if (value == resultData.F_IndustryId[i].F_ItemCode) {
                    return resultData.F_IndustryId[i].F_ItemName;
                }
            }
            return '';
        } else if (type == "F_ClientLevel") {
            for (var i = 0; i < resultData.F_ClientLevel.length; i++) {
                if (value == resultData.F_ClientLevel[i].F_ItemCode) {
                    return resultData.F_ClientLevel[i].F_ItemName;
                }
            }
            return '';
        } else if (type == "F_CityId") {
            for (var i = 0; i < resultData.F_CityId.length; i++) {
                if (value == resultData.F_CityId[i].F_EnCode) {
                    return resultData.F_CityId[i].F_FullName;
                }
            }
            return '';
        } else if (type == "F_AreaId") {
            for (var i = 0; i < resultData.F_AreaId.length; i++) {
                if (value == resultData.F_AreaId[i].F_EnCode) {
                    return resultData.F_AreaId[i].F_FullName;
                }
            }
            return '';
        } else if (type == "F_ActivityCityId") {
            for (var i = 0; i < resultData.F_CityId.length; i++) {
                if (value == resultData.F_CityId[i].F_EnCode) {
                    return resultData.F_CityId[i].F_FullName;
                }
            }
            return '';
        } else if (type == "F_ActivityType") {
            for (var i = 0; i < resultData.F_ActivityType.length; i++) {
                if (value == resultData.F_ActivityType[i].F_ItemCode) {
                    return resultData.F_ActivityType[i].F_ItemName;
                }
            }
            return '';
        }
    }

    function btn_Edit(id, userid) {
        $.modalOpen({
            id: "editForm33",
            title: "客户资料",
            url: "/ClientManager/ClientInfos/EditForm?F_ClientId=" + id + "&F_UserId=" + userid + "",
            width: "1200px",
            height: "700px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    function gridList() {
        var $gridList = $("#gridList");
        var queryJson = {
        };
        $gridList.dataGrid({
            url: "/ClientManager/ClientInfos/GetGridDataByUser",
            postData: { queryJson: JSON.stringify(queryJson) },
            height: 400,
            colModel: [
                {
                    label: '操作', name: '', align: 'left', width: 60, formatter: function (cellvalue, options, rowObject) {
                        return "<ul class=\"zdyUL\" style=\"white-space:nowrap;\"><li><a id=\"" + rowObject["F_Id"] + "\" name=\"" + rowObject["F_Id"] + "\" authorize=\"yes\" onclick=\"btn_Edit('" + rowObject["F_Id"] + "','" + rowObject["F_CreatorUserId"] + "')\"><i class=\"fa fa-pencil-square-o\"></i>编辑</a></li></ul>";
                    }
                },
                {
                    label: '客户类型', name: 'F_ClientType', width: 80, align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ClientType');
                    }
                },
                { label: '公司名称', name: 'F_ClientName', align: 'left', width: 220 },
                {
                    label: '客户等级', name: 'F_ClientLevel', width: 60, align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ClientLevel');
                    }
                },
                {
                    label: '所属行业', name: 'F_IndustryId', width: 60, align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_IndustryId');
                    }
                },                
                { label: '品牌名称', name: 'F_BrandName', width: 120, align: 'left' },
                { label: '项目组', name: 'F_ProjectName', width: 120, align: 'left' },    
                {
                    label: '所在城市', name: 'F_CityId', align: 'left', width: 60, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_CityId');
                    }
                },
                {
                    label: '行政区域', name: 'F_AreaId', align: 'left', width: 60, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_AreaId');
                    }
                },
                { label: '地址', name: 'F_Address', align: 'left', width: 200 },  
                { label: '销售人员', name: 'F_RealName' },
                //{ label: '创建时间', name: 'F_CreatorTime' },
                { label: '', name: 'F_Id', hidden: true },  
                { label: '', name: 'F_CreatorUserId', hidden: true }, 
                { label: '', name: 'projectId', hidden: true },
                { label: '', name: 'brandId', hidden: true },   
            ],
            pager: "#gridPager",
            viewrecords: true,
            multiselect: false,
            sortname: 'F_Id',
            rowNum: 20,
            rowList: [20, 40],
            ondblClickRow: function (rowid, iRow, iCol, e) {
                selectPage = rowid;
                ReloadGridListprojectRecord();
                ReloadGridListserviceRecord();
                ReloadGridListhisttoryRecord();
            },
            loadComplete: function (data) {
                GetGridListprojectRecord(data.rows.length > 0 ? data.rows[0] : undefined);
                GetGridListserviceRecord(data.rows.length > 0 ? data.rows[0] : undefined);
                GetGridListhisttoryRecord(data.rows.length > 0 ? data.rows[0] : undefined);
            }
        });
    }

    function btn_onSearch() {
        var $gridList = $("#gridList");
        var hd_ClientName = $("#hd_ClientName").val();
        var txtF_ClientName = $("#F_ClientName").val();
        var F_ClientName = txtF_ClientName == "" ? txtF_ClientName : hd_ClientName;
        var F_CityIdList = $("#F_CityId").select2("data");
        var F_CityId = "";
        for (var i = 0; i < F_CityIdList.length; i++) {
            if (i == F_CityIdList.length - 1) {
                F_CityId += F_CityIdList[i].id;
            } else {
                F_CityId += F_CityIdList[i].id + ",";
            }
        }
        var queryJson = {
            F_ClientId: F_ClientName,
            F_CityId: F_CityId,
            F_ClientType: $("#F_ClientType").val(),
            F_IndustryId: $("#F_IndustryId").val(),
            F_DemandCash: $("#F_DemandCash").val()
        };
        $gridList.jqGrid('setGridParam', {
            postData: { queryJson: JSON.stringify(queryJson) },
        }).trigger('reloadGrid');
    }

    function btn_Add() {
        $.modalOpen({
            id: "clientAdd",
            title: "新建客户",
            url: "/ClientManager/ClientInfos/Form",
            width: "1200px",
            height: "650px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    function ReloadGridListprojectRecord() {
        var $gridList = $("#gridListprojectRecord");
        var queryJson = {
            F_ClientId: $("#gridList").jqGridRowValue()["F_Id"],
            F_CreatorUserId: $("#gridList").jqGridRowValue()["F_CreatorUserId"],
            F_ProjectId: $("#gridList").jqGridRowValue()["projectId"],
            F_BrandId: $("#gridList").jqGridRowValue()["brandId"]
        };
        $gridList.jqGrid('setGridParam', {
            postData: { queryJson: JSON.stringify(queryJson) },
        }).trigger('reloadGrid');
    }

    function ReloadGridListserviceRecord() {
        var $gridList = $("#gridListserviceRecord");
        var queryJson = {
            F_ClientId: $("#gridList").jqGridRowValue()["F_Id"]
        };
        $gridList.jqGrid('setGridParam', {
            postData: { queryJson: JSON.stringify(queryJson) },
        }).trigger('reloadGrid');
    }

    function ReloadGridListhisttoryRecord() {
        var $gridList = $("#gridListhisttoryRecord");
        var queryJson = {
            F_ClientId: $("#gridList").jqGridRowValue()["F_Id"]
        };
        $gridList.jqGrid('setGridParam', {
            postData: { queryJson: JSON.stringify(queryJson) },
        }).trigger('reloadGrid');
    }

    function GetGridListprojectRecord(rowobj) {       
        var queryJson = {
            F_ClientId: rowobj == undefined ? "-1" : rowobj["F_Id"],
            F_CreatorUserId: rowobj == undefined ? "" : rowobj["F_CreatorUserId"],
            F_ProjectId: rowobj == undefined ? "" : rowobj["projectId"],
            F_BrandId: rowobj == undefined ? "" : rowobj["brandId"]
        };
        var $gridList = $("#gridListprojectRecord");
        $gridList.dataGrid({
            url: "/ClientManager/ClientInfos/GetGridProjectData",
            postData: { queryJson: JSON.stringify(queryJson) },
            height: 320,
            colModel: [
                {
                    label: '需求来源', name: 'F_Source', width: 60, align: 'left', formatter: function (cellvalue) {
                        if (cellvalue == "0") {
                            return '400电话';
                        } else if (cellvalue == "1") {
                            return '销售自拓';
                        } else if (cellvalue == "2") {
                            return '网站订单';
                        } else if (cellvalue == "3") {
                            return '小程序订单';
                        } else if (cellvalue == "4") {
                            return 'App订单';
                        }
                    }
                },
                { label: '公司名称', name: 'F_ClientName', width: 180, align: 'left' },
                { label: '品牌名称', name: 'F_BrandName', width: 80, align: 'left' },
                { label: '项目组', name: 'F_ProjectName', width: 80, align: 'left' },
                {
                    label: '活动主题', name: 'F_ActivityTheme', width: 120, align: 'left'
                },
                {
                    label: '活动类型', name: 'F_ActivityType', width: 60, align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityType');
                    }
                },
                { label: '预算金额', name: 'F_DemandCash', width: 80, align: 'left' },
                { label: '活动开始时间', name: 'F_ActivityStartDate', align: 'left' },
                { label: '活动结束时间', name: 'F_ActivityEndDate', align: 'left' },
                {
                    label: '活动城市', name: 'F_ActivityCityId', align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityCityId');
                    }
                },
                {
                    label: '联系人', name: 'F_Contact', width: 60, align: 'left'
                },
                { label: '联系电话', name: 'F_Phone', width: 80, align: 'left' },
                { label: '创建人', name: 'F_RealName', width: 80 },
                { label: '创建时间', name: 'F_CreatorTime', width: 120, },
                { label: '', name: 'F_Id', hidden: true },
                { label: '', name: 'DemandId', hidden: true },
            ],
            pager: "#gridPagerprojectRecord",
            viewrecords: true,
            multiselect: false,
            sortname: 'F_Id',
            rowNum: 10,
            rowList: [10, 20],
            ondblClickRow: function (rowid, iRow, iCol, e) {
                detial();
            },
            loadComplete: function (data) {
            }
        });
    }

    function detial() {
        var rowobj = $("#gridListprojectRecord").jqGridRowValue();
        $.modalOpen({
            id: "editDemandForm2",
            title: "品牌组需求",
            url: "/ClientManager/ClientInfos/EditDemandForm?DemandId=" + rowobj.DemandId + "",
            width: "1200px",
            height: "650px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    function GetGridListserviceRecord(rowobj) {        
        var queryJson = {
            F_ClientId: rowobj == undefined ? "-1" : rowobj["F_Id"]
        };
        var $gridList = $("#gridListserviceRecord");
        $gridList.dataGrid({
            url: "/ClientManager/ClientInfos/GetGridServiceData",
            postData: { queryJson: JSON.stringify(queryJson) },
            height: 320,
            colModel: [
                { label: '公司名称', name: 'F_ClientName', align: 'left' },                
                {
                    label: '所在城市', name: 'F_CityId', align: 'left', width: 60, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_CityId');
                    }
                },
                {
                    label: '客户等级', name: 'F_ClientLevel', align: 'left', width: 60, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ClientLevel');
                    }
                },
                { label: '项目组', name: 'F_ProjectName', width: 80, align: 'left' },
                { label: '活动主题', name: 'F_ActivityTheme', width: 120, align: 'left' },
                {
                    label: '活动类型', name: 'F_ActivityType', align: 'left', width: 80, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityType');
                    }
                },
                { label: '预算金额', name: 'F_DemandCash', width: 80, align: 'left' },
                { label: '活动开始时间', name: 'F_ActivityStartDate', align: 'left' },
                { label: '活动结束时间', name: 'F_ActivityEndDate', align: 'left' },
                {
                    label: '活动城市', name: 'F_ActivityCityId', align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityCityId');
                    }
                },
                {
                    label: '联系人', name: 'F_Contact', width: 60, align: 'left'
                },
                { label: '联系电话', name: 'F_Phone', width: 80, align: 'left' },               
                { label: '', name: 'F_Id', hidden: true },
            ],
            pager: "#gridPagerserviceRecord",
            viewrecords: true,
            multiselect: false,
            sortname: 'F_Id',
            rowNum: 10,
            rowList: [10, 20],
            ondblClickRow: function (rowid, iRow, iCol, e) {
            },
            loadComplete: function (data) {
            }
        });
    }

    function GetGridListhisttoryRecord(rowobj)
    {      
        var queryJson = {
            F_ClientId: rowobj == undefined ? "-1" : rowobj["F_Id"]
        };
        var $gridList = $("#gridListhisttoryRecord");
        $gridList.dataGrid({
            url: "/ClientManager/ClientInfos/GetClientHistoryOrderList",
            postData: { queryJson: JSON.stringify(queryJson) },
            height: 320,
            colModel: [
                {
                    label: '订单来源', name: 'F_Source', align: 'left', width: 60, formatter: function (cellvalue) {
                        if (cellvalue == "1") {
                            return '销售自拓';
                        } else {
                            return '400电话';
                        }
                    }
                },
                { label: '客户名称', name: 'F_ClientName', width: 80, align: 'left' },
                { label: '活动主题', name: 'F_ActivityTheme', width: 120, align: 'left' },
                {
                    label: '活动类型', name: 'F_ActivityType', width: 80, align: 'left', formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityType');
                    }
                },
                { label: '预算金额', name: 'F_DemandCash', width: 100, align: 'left' },
                { label: '活动开始时间', name: 'F_ActivityStartDate', align: 'left' },
                { label: '活动结束时间', name: 'F_ActivityEndDate', align: 'left' },
                {
                    label: '活动城市', name: 'F_ActivityCityId', align: 'left', width: 120, formatter: function (cellvalue) {
                        return GetDictionaries(cellvalue, 'F_ActivityCityId');
                    }
                },
                {
                    label: '订单进度', name: 'F_OrderState', align: 'left', width: 100, formatter: function (cellvalue) {
                        if (cellvalue == "-1") {
                            return '<span style=\'color:red;\'></span>';
                        }
                        else if (cellvalue == "0") {
                            return '<span style=\'color:#FC8675;\'>待指派</span>';
                        }
                        else if (cellvalue == "1") {
                            return '<span style=\'color:#1ABC9C;\'>场地推荐</span>';
                        }
                        else if (cellvalue == "2") {
                            return '<span style=\'color:#1ABC9C;\'>带看场地</span>';
                        }
                        else if (cellvalue == "3") {
                            return '<span style=\'color:#1ABC9C;\'>意向场地</span>';
                        }
                        else if (cellvalue == "4") {
                            return '<span style=\'color:#1ABC9C;\'>场地报价申请</span>';
                        }
                        else if (cellvalue == "5") {
                            return '<span style=\'color:#1ABC9C;\'>报价单审核</span>';
                        }
                        else if (cellvalue == "6") {
                            return '<span style=\'color:#1ABC9C;\'>场地预定</span>';
                        }
                        else if (cellvalue == "7") {
                            return '<span style=\'color:#1ABC9C;\'>用印申请</span>';
                        } else if (cellvalue == "8") {
                            return '<span style=\'color:#1ABC9C;\'>合同审核</span>';
                        } else if (cellvalue == "9") {
                            return '<span style=\'color:#1ABC9C;\'>需求单流转结束</span>';
                        }
                    }
                },
                {
                    label: '状态跟进进程', name: 'F_OrderStateProcess', align: 'left', width: 100, formatter: function (cellvalue) {
                        if (cellvalue == -1) {
                            return '等待跟进';
                        } else if (cellvalue == 0) {
                            return '等待确认';
                        } else if (cellvalue == 1) {
                            return '通过';
                        } else if (cellvalue == 2) {
                            return '驳回';
                        }
                    }
                },
                { label: '销售跟进人', name: 'F_FlowUser', width: 100, align: 'left' },
                { label: '创建时间', name: 'F_CreatorTime', width: 140, },
                { label: '', name: 'F_Id', hidden: true },
            ],
            pager: "#gridPagerhisttoryRecord",
            viewrecords: true,
            multiselect: false,
            sortname: 'F_Id',
            rowNum: 10,
            rowList: [10, 20],
            ondblClickRow: function (rowid, iRow, iCol, e) {
            },
            loadComplete: function (data) {
            }
        });
    }

    function btn_AddProject() {
        var rowobj = $("#gridList").jqGridRowValue();
        if (rowobj.F_Id) {
            var F_ClientType = rowobj.F_ClientType == "直客" ? "1" : "2";
            $.modalOpen({
                id: "projectAdd",
                title: "新建品牌项目组",
                url: "/ClientManager/ClientInfos/AddProject?F_ClientType=" + F_ClientType + "&F_ClientId=" + rowobj.F_Id + "",
                width: "1200px",
                height: "650px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        } else {
            $.modalAlert("请选中行数据！", "warning");
        }
    }

    function btn_AddProjectDemand() {
        var rowobj = $("#gridList").jqGridRowValue();
        if (rowobj.F_Id) {
            $.modalOpen({
                id: "projectAdd",
                title: "新建品牌组需求",
                url: "/ClientManager/ClientInfos/AddMemand?F_ClientId=" + rowobj.F_Id + "",
                width: "1200px",
                height: "650px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        } else {
            $.modalAlert("请选中行数据！", "warning");
        }
    }

    function btn_Update() {
        var rowobj = $("#gridList").jqGridRowValue();
        if (rowobj.F_Id) {
            $.modalOpen({
                id: "editForm",
                title: "修改客户资料",
                url: "/ClientManager/ClientInfos/EditForm?F_ClientId=" + rowobj.F_Id + "",
                width: "1200px",
                height: "650px",
                callBack: function (iframeId) {
                    top.frames[iframeId].submitForm();
                }
            });
        } else {
            $.modalAlert("请选中行数据！", "warning");
        }
    }
</script>
<div class="zdyPanel">
    <div class="zdyBar" style="float:left;white-space:nowrap;width:50%;">
        <div class="search">
            <table class="form" style="width:100%;">
                <tr>
                    <td class="formValue">
                        <div class="input-group" style="width:100%;">
                            <input type="text" id="F_ClientName" class="form-control textValue" placeholder="请输入公司名称" />
                            <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
                            <input type="hidden" name="hd_ClientName" id="hd_ClientName" value="" />
                        </div>
                    </td>
                    <td class="formValue">
                        <select id="F_CityId" name="F_CityId" class="selectbox">
                            <option value="">==请选择城市==</option>
                        </select>
                    </td>
                    <td class="formValue">                        
                        @*<div class="input-group" style="width:100%;">
                            <input type="text" id="F_DemandCash" class="form-control textValue" placeholder="请输入预算金额,结果大于预算金额" />
                            <span class="input-group-addon"><i class="glyphicon glyphicon-usd"></i></span>
                        </div>*@ 
                    </td>
                </tr>
                <tr>
                    <td class="formValue">
                        <select id="F_IndustryId" name="F_IndustryId" class="selectbox">
                            <option value="">==请选择行业==</option>
                        </select>
                    </td>
                    <td class="formValue">
                        <select id="F_ClientType" name="F_ClientType" class="selectbox">
                            <option value="">==请选择客户类型==</option>
                        </select>
                    </td>
                    <td class="formValue"></td>
                </tr>
                <tr>
                    <td class="formValue"></td>                    
                    <td class="formValue">
                        <a class="btn btn-primary" onclick="btn_onSearch()">按条件搜索</a>
                    </td>
                    <td class="formValue"></td>
                </tr>
            </table>
        </div>
    </div>
    <div class="zdyBar" style="float:right;white-space:nowrap;width:50%;padding-top:5px;">
        <div style="float:right;">
            <div class="btn-group">
                <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
            </div>
            <div class="btn-group">
                <a class="btn btn-primary" onclick="btn_Add()"><i class="fa fa-eraser">新建客户资料</i></a>
            </div>
            @*<div class="btn-group">
                <a class="btn btn-primary" onclick="btn_Update()"><i class="fa fa-pencil-square-o">修改客户资料</i></a>
            </div>
            <div class="btn-group">
                <a class="btn btn-primary" onclick="btn_AddProject()"><i class="fa fa-eraser">新建品牌项目组</i></a>
            </div>
            <div class="btn-group">
                <a class="btn btn-primary" onclick="btn_AddProjectDemand()"><i class="fa fa-eraser">新建品牌需求</i></a>
            </div>*@
        </div>        
    </div>
</div>
<div class="zdyGirdPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
<div class="zdyContentPanel">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#projectRecord" data-toggle="tab">品牌项目组列表</a></li>
        <li><a href="#serviceRecord" data-toggle="tab">服务公司列表</a></li>
        <li><a href="#histtoryRecord" data-toggle="tab">历史合作记录</a></li>
    </ul>
    <div class="tab-content">
        <div class="tab-pane fade in active" id="projectRecord">
            <div class="zdyGirdPanel">
                <table id="gridListprojectRecord"></table>
                <div id="gridPagerprojectRecord"></div>
            </div>
        </div>
        <div class="tab-pane fade" id="serviceRecord">
            <div class="zdyGirdPanel">
                <table id="gridListserviceRecord"></table>
                <div id="gridPagerserviceRecord"></div>
            </div>
        </div>
        <div class="tab-pane fade" id="histtoryRecord">
            <div class="zdyGirdPanel">
                <table id="gridListhisttoryRecord"></table>
                <div id="gridPagerhisttoryRecord"></div>
            </div>
        </div>
    </div>
</div>